#!/bin/bash

folder_path="./cuda_file"
if [ ! -d "$folder_path" ]; then
    mkdir -p "$folder_path"
fi

echo "--------------------**begin compiling**--------------------"

nvcc -g -G test.cu -o cuda_file/mycuda   \
    -I /usr/include/hdf5/serial -L /usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5 -lhdf5_cpp

if [ $? -eq 0 ]; then
    echo "Compilation successfully!."
    chmod +777 ./cuda_file/mycuda
    echo "--------------------**begin running**--------------------"
    ./cuda_file/mycuda ./python/weight_14
else
    echo "Compilation failed."
    exit 1
fi
